Skip to content

Conversation

@the-mikedavis
Copy link
Collaborator

This change adds config options for controlling the is_enabled/0 queue type callback for classic queues, quorum queues and stream queues. This is useful for operators to be able to control whether users can declare these queues - i.e. to prevent users from declaring queue types which cannot be supported operationally.

Setting

queue_types.stream.enabled = false

In a config file for example prevents stream queues from being declared.

This change adds config options for controlling the `is_enabled/0`
queue type callback for classic queues, quorum queues and stream
queues. This is useful for operators to be able to control whether
users can declare these queues - i.e. to prevent users from declaring
queue types which cannot be supported operationally.

Setting

    queue_types.stream.enabled = false

In a config file for example prevents stream queues from being declared.
@the-mikedavis
Copy link
Collaborator Author

I didn't add a test case for this since it's a very straightforward change. This can be tested manually by creating a config file config.conf with queue_types.stream.enabled = false, running the broker (make run-broker RABBITMQ_CONFIG_FILE=config.conf) and trying to declare a stream queue through either the management UI or with perf-test --stream-queue.

I also didn't add a config option for the MQTT QoS0 queue type since I think that queue type is more of an implementation detail and not worth controlling other than with the feature flag.

@michaelklishin michaelklishin added this to the 4.3.0 milestone Sep 26, 2025
@michaelklishin michaelklishin merged commit d875247 into main Sep 26, 2025
287 checks passed
@michaelklishin michaelklishin deleted the md/configure-queue-type-enable branch September 26, 2025 20:50
michaelklishin added a commit that referenced this pull request Sep 26, 2025
Allow configuring whether queue types are enabled (backport #14624)
@mkuratczyk
Copy link
Contributor

This PR prevents streams from being declared in some, but not all, ways. If you just run stream-perf-test, it declares a stream without problems, despite queue_types.stream.enabled = false.

Moreover, trying to disable classic queues seems to prevent a node from booting at all. Just trying make run-broker with queue_types.classic.enabled = false leads to:

error:{badmatch,{error,queue_type_feature_flag_is_not_enabled}}

    rabbit:insert_default_data/0, line 1236
    rabbit_boot_steps:-run_step/2-lc$^0/1-0-/2, line 53
    rabbit_boot_steps:run_step/2, line 60
    rabbit_boot_steps:-run_boot_steps/1-lc$^0/1-0-/1, line 24
    rabbit_boot_steps:run_boot_steps/1, line 25
    rabbit:start/2, line 1009
    application_master:start_it_old/4, line 299

@the-mikedavis
Copy link
Collaborator Author

For the streams protocol it looks like we'll need to add a check of rabbit_queue_type:is_enabled/1 in rabbit_stream_manager:do_create_stream/4 so it behaves more like rabbit_amqqueue:declare/7.

For the failure to boot it looks like this check fails when adding the default vhost:

try rabbit_queue_type:discover(DQT) of
QueueType when is_atom(QueueType) ->
case rabbit_queue_type:is_enabled(QueueType) of
true ->
ok;
false ->
throw({error, queue_type_feature_flag_is_not_enabled})
end

So we can't add vhosts where the default queue type is not enabled. I think it might be more reasonable to warn in that situation since you might always explicitly declare your queue types - IMO is_enabled/1 should only stop attempts to declare a queue and not block vhost creation.

I will send some follow-ups. Thanks @mkuratczyk!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants